package threads;

class RunnableJob implements Runnable {
	public void run() {
		System.out.println("State: RUNNING");
		System.out.println("Is alive?: true");
	}

}

public class ThreadTestStatus {

	public static void main(String[] args) throws InterruptedException {

		RunnableJob runnableJob = new RunnableJob();
		Thread thread = new Thread(runnableJob);

		displayStateAndIsAlive(thread);
		thread.start();
		displayStateAndIsAlive(thread);
		Thread.sleep(1000);
		displayStateAndIsAlive(thread);
	}

	public static void displayStateAndIsAlive(Thread thread) {
		// java.lang.Thread.State can be NEW, RUNNABLE, RUNNING, DEAD
		System.out.println("State: " + thread.getState());
		System.out.println("Is alive?: " + thread.isAlive());
	}

}